<?php
/* Jose Trujillo
 * - Define constants and settings
 * - Dictates how errors are handled
 * - Defines useful functions
 */
 
// ********************************** //
// ************ SETTINGS ************ //

// Flag variable for site status
define('LIVE', FALSE);

// Admin contact address
define('EMAIL', 'katarsix@gmail.com');

// Site URL (base for all redirections)
define ('BASE_URL', 'http://localhost/WOG/');

// Home Page Site URL
define ('BASE_HOMEPAGE_URL', 'http://localhost/WOG/index.php');

// Location of the MySQL connection script
define ('MYSQL', 'connectionSQL.php');

// Location of the MySQL connection script
define ('STATEM_MYSQL', 'queriesSQL.php');

// Adjust the time zone for PHP 5.1 and greater
date_default_timezone_set ('America/Vancouver');

// Define the directory for uploading files
define('UPLOADS_DIR', 'Uploads/');

// Define the directory for uploading images for Events
define('UPLOADS_IMGEVENTS_DIR', 'Uploads/imgEvent/');

// Define the directory for Temporary files (All content can be deleted)
define('UPLOADS_TEMP_DIR', '/Uploads/temp/');

// Define the directory for uploading images for Members
define('UPLOADS_IMGMEMBER_DIR', 'Uploads/imgMember/');



// Define the minimum number of digits (chars and #s and symbols)
// for username and password
define('MIN_CHARS_USERNAME_PASSW', 6);
// Define the maximum number of digits (chars and #s and symbols)
// for username and password
define('MAX_CHARS_USERNAME_PASSW', 25);


// Define the maximum number of MB for a picture$
define('MAX_MB_SIZE_IMG', 5);

// Define the maximum width in px for Events Img
define('MAX_PX_WIDTH_IMG', 320);

// Define the maximum height in px for Events Img
define('MAX_PX_HEIGHT_IMG', 370);


// Define the annual fee for members
define('ANNUAL_FEE_MEMBERS_INT', 75);


// Define the maximum number of guests that can be invited
define('MAX_NUM_ALLOW_GUESTS', 5);


// Define the number of words to display for Past and Future Events
define('MAX_NUM_WORDS_EVENTS_PAST_FUTURE', 80);

// Define the maximum number of Past Events to display
define('MAX_EVENTS_PAST_DISPLAY', 4);

// Define the maximum number of Future Events to display
define('MAX_EVENTS_FUTURE_DISPLAY', 3);


// Define the maximum number of hours before an event closes
// i.e. Event Date: 15 January 2020 & MAX_EVENTS_HOURS_BLOCK_RSVP=48
//      Hence, It will be Open until 13 January 2020 (After that, blocked for RSVP)
define('MAX_EVENTS_HOURS_BLOCK_RSVP', 48);


// Define the maximum number of guests to allow for RSVP for AGM Event
define('MAX_EVENTS_GUESTS_AGM', 0);

// Define the maximum number of guests to allow for RSVP for Whiffette Event
define('MAX_EVENTS_GUESTS_WHIFFETTE', 1);

// Define the maximum number of guests to allow for RSVP for Regular Event
define('MAX_EVENTS_GUESTS_REGULAR', 5);


// **************************************** //
// ************ ERROR MESSAGES ************ //

// Define message to be displayed for password information
define('MSSG_PASSW_REQ', 'Use only letters, numbers, the dot character (.), and the underscore symbol (_). Must be between ' . MIN_CHARS_USERNAME_PASSW . ' and ' . MAX_CHARS_USERNAME_PASSW . ' characters long. Case Sensitive.');




// ************ ERROR MESSAGES ************ //
// **************************************** //



// ************ SETTINGS ************ //
// ********************************** //


// ****************************************** //
// ************ ERROR MANAGEMENT ************ //

// Create the error handler:
function my_error_handler ($e_number, $e_message, $e_file, $e_line, $e_vars) {

	// Build the error message.
	$message = "<p>An error occurred in script '$e_file' on line $e_line: $e_message\n<br />";
	
	// Add the date and time:
	$message .= "Date/Time: " . date('n-j-Y H:i:s') . "\n<br />";
	
	// Append $e_vars to the $message:
	$message .= "<pre>" . print_r ($e_vars, 1) . "</pre>\n</p>";
	
	if (!LIVE) { // Development (print the error).
	
		echo '<div class="error">' . $message . '</div><br />';
		
	} else { // Don't show the error:
	
		// Send an email to the admin:
		mail(EMAIL, 'Site Error WOG!', $message, 'From: ' . EMAIL);
		
		// Only print an error message if the error isn't a notice:
		if ($e_number != E_NOTICE) {
			echo '<div class="error">A system error occurred. We apologize for the inconvenience.</div><br />';
		}
	} // End of !LIVE IF.

} // End of my_error_handler() definition.

// Use my error handler.
set_error_handler ('my_error_handler');

// ************ ERROR MANAGEMENT ************ //
// ****************************************** //

?>
